<template>
  <el-main>
    <table>
      <tr bgcolor="#ffdead">
        <td>租约保理申请单号</td>
        <td>{{factoringOne.factoringOrderNo}}</td>
      </tr>
      <tr bgcolor="#ffdead">
        <td>应收租约合计</td>
        <td>{{factoringOne.rentMoney}} </td>
      </tr>
      <tr bgcolor="#ffdead">
        <td>保理授信金额合计</td>
        <td>{{factoringOne.factoringCreditMoney}}</td>
      </tr>
      <tr bgcolor="#ffdead">
        <td>保理利息合计</td>
        <td>{{factoringOne.factoringAdditionalMoney}}</td>
      </tr>
      <tr bgcolor="#ffdead">
        <td>实收保理金额</td>
        <td>{{factoringOne.factoringTrueMoney}}</td>
      </tr>
      <tr bgcolor="#ffdead">
        <td>申请状态</td>
        <td>
          <span v-if="factoringOne.applyState==1">待审核</span>
          <span v-if="factoringOne.applyState==2">初审通过(待复审)</span>
          <span v-if="factoringOne.applyState==3">初审不通过</span>
          <span v-if="factoringOne.applyState==4">复审通过</span>
          <span v-if="factoringOne.applyState==5">复审不通过</span>
        </td>
      </tr>
    </table>
    <span v-if="factoringOne.applyState == 1 || factoringOne.applyState == 2">
    审核备注<el-input type="textarea" v-model="auditMemo" style="width: 180px"></el-input>
    </span>
    <span v-if="factoringOne.applyState == 1">
        <el-button type="warning" plain @click="toReviewThe(factoringOne.id,factoringOne.applyState,0)">初审审核通过</el-button>
        <el-button type="warning" plain @click="toReviewThe(factoringOne.id,factoringOne.applyState,1)">初审审核不通过</el-button>
    </span>
    <span v-if="factoringOne.applyState==2">
        <el-button type="warning" plain @click="toReviewThe(factoringOne.id,factoringOne.applyState,0)">复审审核通过</el-button>
        <el-button type="warning" plain @click="toReviewThe(factoringOne.id,factoringOne.applyState,1)">复审审核不通过</el-button>
    </span>
  </el-main>
</template>

<script>
import {getFactoring,updateFactoring} from "@/api/banking/leasefactoringreview";
export default {
  data() {
    return {
      factoringOne:{},
      auditMemo:'',
    }
  },
  methods: {
    getFactoringOne(){
      let id = this.$route.query.id;
      getFactoring(id).then(res=>{
        console.log("输出对象");
        this.factoringOne = res.msgData;
      })
    },
    toReviewThe(id,applyState,yesNo){
        updateFactoring(id,applyState,yesNo,this.auditMemo).then(res=>{
            if(res.flag){
               //修改成功
               this.$message.success("审核完毕");
               this.$router.push("/banking/leasefactoringreview");
            }
        })
    }
  },
  created() {
     this.getFactoringOne();
  }
}
</script>

<style scoped>

</style>
